package net.tv90.bfmccoreqqbot.api.handler;

import net.tv90.bfmccoreqqbot.api.MessageHandler;
import net.tv90.bfmccoreqqbot.api.annotation.AdminOnly;
import net.tv90.bfmccoreqqbot.api.annotation.MessageCheck;
import net.tv90.bfmccoreqqbot.api.annotation.MessageCheckPolicy;
import net.tv90.bfmccoreqqbot.api.annotation.MessageType;
import net.tv90.bfmccoreqqbot.api.entity.MessageContext;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@AdminOnly
@MessageType("清除冷却")
@MessageCheck(MessageCheckPolicy.EQUALS)
public class ClearCoolDownMessageHandler implements MessageHandler {

    public static final List<String> coolDownQqIdBypassList = Arrays.asList("3449023732", "1287969481");
    public static final List<String> coolDownQqIdList = new ArrayList<>();
    public static boolean enableCoolDown = false;

    public static void clearCoolDownQqIdList() {
        ClearCoolDownMessageHandler.coolDownQqIdList.clear();
    }

    @Override
    public String handleMessage(MessageContext msg) {
        if (enableCoolDown) {
            clearCoolDownQqIdList();
            return "已清除所有用户查询冷却";
        }

        return null;
    }

    @Override
    public boolean onPreHandleMessage(MessageContext msg) {
        System.out.println("接受到消息: " + msg.getMessage());
        return true;
    }
}
